#pragma once
#include <iostream>

namespace util::file
{

/**
 * @brief Get the last write time of a file
 *
 * @param file_path The path to the file
 * @return The last write time of the file as a string in the format
 *         "YYYY-MM-DD HH:MM:SS". If there is an error, the string "1970-01-01
 *         00:00:00" is returned.
 */
std::string GetLastWriteTime(const std::string& file_path);

/**
 * Retrieves the creation time of a specified file as a formatted string.
 *
 * @param file_path The path to the file whose creation time is to be retrieved.
 * @return A string representing the creation time in "YYYY-MM-DD HH:MM:SS" format.
 *         Returns "1970-01-01 00:00:00" if the file's creation time cannot be obtained.
 */
std::string GetCreateTime(const std::string& file_path);

/**
 * @brief Ensures that a directory exists
 *
 * If the directory does not exist, this function will attempt to create it.
 * If the directory does exist, this function will return false.
 *
 * @param path The path of the directory to check and create
 * @return true if the directory was created, false if it already exists.
 */
bool EnsureDirectoryExists(const std::string& path);

/**
 * @brief Remove a directory and all its contents
 *
 * @param dirpath The path to the directory to be removed
 *
 * @return true if the directory was successfully removed, false otherwise
 */
bool RemoveDirectory(const std::string& dirpath);

bool ExistsDir(const std::string& dirpath);

bool ExistsFile(const std::string& dirpath);

bool RemoveFile(const std::string& dirpath);

std::string ReadFile(const std::string& filename);

bool IsInvalidFile(const std::string& file_name);

std::string GetLatestFile(const std::string& dirpath, const std::string& extension = "");

std::streamsize GetFileSize(const std::string& file_path);
// 获取数据文件夹的路径
std::string getDataPath();

bool IsZipFile(const std::string& filePath);

}  // namespace util